<template>
	<view class="reply-container">
		<view style="padding: 20rpx;">
			<view class="title"><text style="color: red;">*</text>申诉原因</view>
			<textarea class="content" v-model="params['原因']" placeholder="请输入申诉原因..." name="" id="" cols="30" rows="10"></textarea>
		</view>
		<view class="title" style="margin-left: 20rpx;">申诉附件</view>
		<view style="margin-left: 8rpx;">
			<uploader @input='onchange'></uploader>
		</view>
		<button class="btn" @click="submit">提交</button>
	</view>
</template>

<script>
	import uploader from '@/components/my-components/image-uploader.vue'
	export default {
		data() {
			return {
				params: {
					原因: null,
				}
			}
		},
		components: {
			uploader
		},
		onLoad(options) {
			this.params = {...JSON.parse(options.record), 原因: null}
			console.log('params', this.params)
		},
		methods: {
			onchange(e) {
				this.params.附件 = e
			},
			submit() {
				if(this.params.原因.trim() == ''){
					uni.showToast({
						title: '请填写申诉原因',
						icon: 'none'
					})
				}else {
					this.handleAppeal()
				}
			},
			handleAppeal() {
				uni.showLoading({
					mask: true
				})
				this.$http2.post('/transactionCompete/appeal/add', this.params).then(res => {
					console.log(res)
					if(res.code === 10000){
						uni.redirectTo({
							url: '/ticketSystem/acceptSuccess/acceptSuccess?path=/pages/service/service' + '&title=返回服务页面'
						})
						// uni.redirectTo({
						// 	url: '/ticketSystem/acceptSuccess/acceptSuccess?path=/assessSystem/index/index' + '&title=返回考评首页'
						// })
					}
				})
			}
		}
	}
</script>

<style lang="scss">
	.reply-container {
		// padding: 20rpx;
		.title {
			margin-bottom: 20rpx;
		}
		.content {
			width: 710rpx;
			padding: 20rpx;
			border: 2rpx solid #ccc;
		}
		.btn {
			width: 568rpx;
			height: 80rpx;
			line-height: 80rpx;
			margin-top: 100rpx;
			background: linear-gradient(to right, #3350D9, #1152FC);
			// background-color: #1152FC;
			color: #fff;
		}
	}
</style>